<template>
    <div>
        <ul>
            <!--<list v-for="item in list" :list="list"></list>-->
        </ul>
    </div>
</template>

<script>
    //import list from './list.vue'
    export default {
       data(){
         return {
           isSwitch:true,
           scroll:null,
           list:[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
         }
       },
      components:{
        list
      },
      watch:{
        scroll(val){
          if(val==0 && this.isSwitch){
            let arr=[1,2,3,4,5,6]
            setTimeout(()=>{
              this.list.unshift(...arr)
            },1000)

          }
        }
      },
      mounted(){
        window.addEventListener('scroll', this.handleScroll)
      },
      methods:{
        handleScroll (){
          this.scroll = window.pageYOffset ||  document.documentElement.scrollTop || document.body.scrollTop
          //console.log(this.scroll)
        },
      }
    }
</script>

<style scoped>
   li{
       height: 1rem;
       line-height: 1rem;
       border-bottom: 1px solid #888;
       text-align: center;
   }
</style> 